import Vue from 'vue'
import App from './App.vue'
import VueResource from 'vue-resource'
import VueRouter from 'vue-router'
import VueAwesomeSwiper from 'vue-awesome-swiper'
import VueLazyload from 'vue-lazyload'  //引入这个懒加载插件

/*全局变量*/
import global_ from './components_v2/Global.vue';
Vue.prototype.GLOBAL = global_;
// 注册
Vue.filter('my-filter', function (value) {
    if(value){
        return '¥'+ value
    }
});
Vue.use(VueResource);
Vue.use(VueRouter);
Vue.use(VueAwesomeSwiper);
Vue.use(VueLazyload, {
    preLoad: 1.3,
    error: '/src/image/1392662591495_1140x0.gif',  //图像的src加载失败
    loading: '/src/image/1392662591495_1140x0.gif', //src的图像加载
    attempt: 1,
    listenEvents: [ 'scroll', 'mousewheel' ]
});
/*引入组件路由*/
import head from './components/head.vue';
import fruits from  './components_v2/fruits.vue';
import furniture from  './components_v2/furniture.vue';
import seafood from './components_v2/seafood.vue';
import special from  './components_v2/special.vue';
import share from     './components_v2/share.vue';
import recommend from  './components_v2/recommend.vue';
import classification from './components_v2/classification.vue';
import shop from './components_v2/shop.vue';
import details from './components_v2/details.vue';
import center from './components_v2/center.vue';
import myorder from './components_v2/myorder.vue';
import all from './components_v2/all.vue';
import goods from './components_v2/goods.vue';
import receipt from './components_v2/receipt.vue';
import payment from './components_v2/payment.vue';
import evaluate from './components_v2/evaluate.vue';
import shopDetails from './components_v2/shopDetails.vue';
import commodity from './components_v2/commodity.vue';
import detail from  './components_v2/detail.vue';
import shopEvaluate from './components_v2/shopEvaluate .vue';
import list from './components_v2/list.vue';
import searchFruits from  './components_v2/searchFruits.vue';
import listDetail from './components_v2/listDetail.vue';
import customerService from './components_v2/customerService.vue';
import apply from './components_v2/apply.vue';
import record from './components_v2/record.vue';
import refund from './components_v2/refund.vue';
import refundDetail from './components_v2/refundDetail.vue';
import idea from './components_v2/idea.vue';
import integral from './components_v2/integral.vue';
import help from './components_v2/help.vue';
import logistics from './components_v2/logistics.vue';
import orderSuccess from './components_v2/orderSuccess.vue';
import successfulTrade from './components_v2/successfulTrade.vue';
import indexBox from  '../src/indexBox.vue';
import index from './components_v2/index.vue';
import Orderdetails from './components_v2/Orderdetails.vue';
/*优惠券*/
import Coupon from './components_v2/Coupon.vue';
/*登录*/
import login from '../src/login.vue';
/*分享你页面*/
import shareLi from './components_v2/shareLi.vue';
//个人中心资料页面
import personCenter from './components_v2/personCcenter.vue';
/*个人中心地址首页*/
import addIndex from './components_v2/addIndex.vue';
/*个人中心编辑的地址*/
import addressEd from './components_v2/addressEd.vue';
/*个人中心新增地址*/
import addNew from './components_v2/addNew.vue';
//个人中心绑定手机号
import  bindPhone from './components_v2/bindPhone.vue';
//个人中心设置密码
import person_psd from './components_v2/person_psd.vue';
//首页会员
import Member from './components_v2/Member.vue';
//会员权益
import member_right from  './components_v2/member_right.vue';
//我的余额
import my_balance from './per_center/my_balance.vue';
/*账单明细*/
import Bill_details from './per_center/Bill_details.vue';
/*我的积分*/
import my_integral from './per_center/my_integral.vue';
/*我的积分规则*/
import Integral_rule from './per_center/Integral_rule.vue';
/*支付成功页面*/
import Pay_success from './Payment_success/Pay_success.vue';
/*试吃页面*/
import try_eat from './per_center/try_eat.vue';
/*往期会员试吃记录*/
import Past_members from './per_center/Past_members.vue';
/*试吃详情页面*/
import try_detail from './per_center/try_detail.vue';
/*试吃页面发布动态*/
import Release from './per_center/Release..vue';
/*会员返现*/
import Back_now from './per_center/Back_now.vue';
/*新人试吃领赠品*/
import new_try from './per_center/new_try.vue';
/*会员商品*/
import member_good from './per_center/member_good.vue';
/*会员二维码*/
import QR_code from './per_center/QR_code.vue';
/*红包劵*/
import Red_coupon from './per_center/Red_coupon.vue';
/*发票信息*/
import my_invoice from './per_center/my_invoice.vue';
/*邀请好友返现*/
import Invite_friends from './per_center/Invite_friends.vue';
/*邀请客服*/
import Cus_service from './per_center/Cus_service.vue';
//活动页
import huodong from './components_v2/huodong.vue';
//蔬菜页 
import greens from './components_v2/greens.vue';
//新人礼
import new_people from './Payment_success/new_people.vue';
//一小时
import arrive_one from './arrive/arrive_one.vue';
//两小时达选择地址
import chose_add from './arrive/chose_add.vue';
//选择地址2
import arrive_two from './arrive/arrive_two.vue';
//未授权
import unauthorized from './arrive/unauthorized.vue'


import axios from "axios";
Vue.prototype.$ajax=axios;
//配置路由，定义路由
var myRoute=[
    {
        path:'/index',/*name:'indexBox',*/ component:indexBox,//首页

        children:[
            {
                path:'/',/*name:'indexBox',*/ component:index, /*meta: { keepAlive: true },*/
                children:[
                    {
                        path:'/recommend',
                        component:recommend,
                       /* meta: { keepAlive: true },*/
                    },
                /*    {
                        path:'/share',
                        component:share,
                    },*/
                    {
                        path:'/fruits',
                        component:fruits,
                       /* meta: { keepAlive: true },*/
                    },
                    {
                        path:'/seafood',
                        component:seafood,
                       /* meta: { keepAlive: true },*/
                    },
                    {
                        path:'/special',
                        component:special,
                       /* meta: { keepAlive: true },*/
                    },
                    {
                        path:'/recommend',
                        component:recommend,
                        /*meta: { keepAlive: true },*/
                    },
                    {
                        path:'/greens',
                        component:greens,
                        /*meta: { keepAlive: true },*/
                    },
                    {
                        path:'/furniture',
                        component:furniture,
                       /* meta: { keepAlive: true },*/
                    },
                ]
    }]},
    {
        path:'/share',name:'index',
        component:share,
    },
    {   path:'/classification', name:'index',//分类
        component:classification,
    },
    {
        path:'/shop',name:'app', component:shop
    },
    {
            path:'/details',///shop/adress/details
            /* name:'app',*/  //这里暂时修改
            component:details,

    },
    {path:'/Orderdetails',/*name:'app',*/component:Orderdetails},//订单详情页 //这里暂时修改

    { path:'/center', /*name:'app',*///个人中心 //这里暂时修改
        component:center,
    },
    {path:'/Member',component:Member},//首页会员
    {path:'/myorder', component:myorder, //订单详情的tab
        children:[
           {
               path: '/',
               redirect: '/myorder/all'
           },
           {
               path:'/myorder/all', component:all
           },
           {
               path:'/myorder/payment', component:payment
           },
           {
               path:'/myorder/goods', component:goods
           },
           {
               path:'/myorder/receipt', component:receipt
           },
           {
               path:'/myorder/evaluate', component:evaluate
           },
       ]
    },
    { path:'/list',component:list},//详情列表
/*分类页面跳转列表页面*/
    {path:'/shopDetails', component:shopDetails,
    children:[
        {
            path: '/',
            redirect: '/shopDetails/commodity'
        },
        {
            path:'/shopDetails/commodity', component:commodity,
        },
        {
            path:'/shopDetails/detail', component:detail
        },
        {
            path:'/shopDetails/shopEvaluate', component:shopEvaluate,
        },
    ]
    },
    {path:'/searchFruits',component:searchFruits},//搜索水果
    {path:'/listDetail',component:listDetail},
    {path:'/refund',component:refund},
    {path:'/idea',component:idea},
    {path:'/integral',component:integral},
    {path:'/help',component:help},
    {path:'/logistics',component:logistics},
    {path:"/orderSuccess",component:orderSuccess},
    {path:'/successfulTrade',component:successfulTrade},
    {path:'/refundDetail',component:refundDetail},
    {path:'/Coupon',component:Coupon},//优惠券
    /*登录*/
    {path:'/login',component:login},
    /*分享礼页面*/
    {path:'/shareLi',component:shareLi},
    {path:'/personCenter',component:personCenter},//个人中心已登录状态个人资料
    {path:'/addIndex',component:addIndex},//个人中心地址首页
    {path:'/addressEd',component:addressEd},//个人中心地址编辑
    {path:'/addNew',component:addNew},//个人中心地址新增
    {path:'/bindPhone',component:bindPhone},//个人中心绑定手机号
    {path:'/person_psd',component:person_psd},//个人中心设置密码
    {path:'/member_right',component:member_right},//会员权益
    {path:'/my_balance',component:my_balance},//我的余额
    {path:'/Bill_details',component:Bill_details},//账单明细
    {path:'/my_integral',component:my_integral},//我的积分
    {path:'/Integral_rule',component:Integral_rule},//我的积分规则
    {path:'/Pay_success',component:Pay_success},//支付成功的页面
    {path:'/try_eat',component:try_eat},//试吃页面
    {path:'/Past_members',component:Past_members},//往期会员试吃记录
    {path:'/try_detail',component:try_detail},//会员试吃详情页
    {path:'/Release',component:Release},//试吃页面发布动态
    {path:'/Back_now',component:Back_now},//会员返现
    {path:"/new_try",component:new_try},//新人试吃领赠品
    {path:'/member_good',component:member_good},//会员商品
    {path:"/QR_code",component:QR_code},//会员优惠嘛
    {path:'/Red_coupon',component:Red_coupon},//红包优惠券
    {path:'/my_invoice',component:my_invoice},//确认发票信息
    {path:'/Invite_friends',component:Invite_friends},//邀请好友返现
    {path:'/Cus_service',component:Cus_service},//专享客服
    {path:'/huodong',component:huodong},//活动页
    {path:"/greens",component:greens},//蔬菜页面
    {path:'/new_people',component:new_people},//新人礼页面
    {path:'/arrive_one',component:arrive_one},//一小时到
    {path:'/chose_add',component:chose_add},//两小时达
    {path:'/arrive_two',component:arrive_two},//搜索地址2
    {path:'/unauthorized',component:unauthorized},//未授权地址

    {path:'/customerService',component:customerService, //售后服务
        children:[
         {
             path: '/',
             redirect: '/customerService/apply'
         },
         {
             path:'/customerService/apply',component:apply
         },
         {
             path:'/customerService/record',component:record
         },
     ]
    },
    {path: '*', redirect: '/recommend' },

    ];
//实例化路由对象老老实实的写这个名字route
var routers=new VueRouter({
    mode: 'history',
    routes:myRoute
});
new Vue({
    el: '#app',
    router:routers,
    render: h => h(App)
})
